#多线程编程

#通过实例化threading.Thread类创建线程

import time
import threading

#定义线程
def test_thread(param='hi', sleep=3):
    time.sleep(sleep)
    print(param)


def main():
    # 创建线程
    thread_hi = threading.Thread(target=test_thread)
    # 启动线程
    thread_hi.start()
    print('Main thread has ended!')


if __name__ == '__main__':
    main()
#输出：Main thread has ended!  hi
